
<?php
if(isset($_COOKIE['token'])){
    $rand1=$_COOKIE['token'];
    session_start();
   if(isset( $_SESSION[$rand1])){
    $id = $_SESSION[$rand1];
    $rand1=md5(rand(1000,9999));
    setcookie('token',$rand1,time()+10000);
    $_SESSION[$rand1]=$id;
    ?>
    <html>
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
        <div>
            <table border="1" width="800px" cellspacing="0">
            <?php
            $mysqli = mysqli_connect('localhost','root','root','user');
            $select ="select * from user2 ";
            $query  = mysqli_query($mysqli,$select);
            $arr  = mysqli_fetch_all($query);
            if(isset($_POST['submit'])){
                $shan = $_POST['delete'];
                $delete="delete from user2 where id=$shan";
                mysqli_query($mysqli,$delete);
            }


            ?>
                <div>
                    <form action="#" method="post" enctype="multipart/form-data">

                        <input type="text" name="delete" placeholder="请输入id">

                        <input type="submit" name="submit" value="确认删除"><br/><br/>

                    </form>
                </div>

                  <tr>
                      <td>ID</td><td>UID</td><td>昵称 </td><td>个性签名：</td><td>头像</td>
                  </tr>
                   <?php
            foreach ($arr as $v) {
               ?>
               <tr>
                   <td> <?php echo $v[0] ?> </td>
                   <td> <?php echo $v[1] ?> </td>
                   <td> <?php echo $v[2] ?> </td>
                   <td> <?php echo $v[3] ?> </td>
                   <td><img src="tu/<?php echo $v[4] ?>"/></td>
               </tr>
                <?php
                                }
                ?>
            </table>
        </div>
    </body>
    </html>

 <?php
   }
    //登录状态
}else{
    $url="login.html";
    header("Location:$url");
}
?>
